/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 spell_icon_window.h

	$Header: /heroes4/spell_icon_window.h $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "spell_icon_window.h"

#include "mouse_event.h"
#include "simple_dialog.h"
#include "spell.h"
#include "spell_icon.h"
#include "spell_properties.h"
// -------------------------------------------------------------------
// window to display a skill icon
// -------------------------------------------------------------------
t_spell_icon_window::t_spell_icon_window( t_spell spell, t_screen_rect const& rect,
										  t_window* parent)
            : t_bitmap_layer_cache_window( t_bitmap_layer_ptr(), rect.top_left(), parent )
{
	m_height = rect.height();
	m_spell = k_spell_none;
	set_spell( spell );
}

// -------------------------------------------------------------------
// window to display a skill icon
// -------------------------------------------------------------------
void t_spell_icon_window::right_button_up( t_mouse_event const& event )
{
	if (m_spell == k_spell_none)
		return;
	show_popup_text( get_spell_help( m_spell ), event.screen_point );
}

// -------------------------------------------------------------------
// window to display a skill icon
// -------------------------------------------------------------------
void t_spell_icon_window::set_spell( t_spell spell )
{
	if (spell == m_spell)
		return;
	m_spell = spell;
	set_visible( spell != k_spell_none );
	if (spell != k_spell_none )
	{
		set_bitmap( get_spell_icon( spell, m_height ));
		set_help_balloon_text( get_spell_name( spell ));
	}
}

